﻿@model List<Event>

@{
    Category category = ViewBag.Category;
    List<DateTime> upcomingDate = ViewBag.UpcomingDate;

    ViewBag.MenuOneId = category.Id;
    ViewBag.Title = "Sự kiện thời trang " + category.Name.ToLower();
}

<div id="event" class="index">
    <div class="container">
        @if (Model.Count > 0)
        {
            int index = 1;

            <div class="bg-content-transparent">
                <div class="bg-title visible-sm visible-xs">
                    <h4>Sự kiện đang diễn ra</h4>
                </div>
                <div class="row min-padding">
                    <div class="col-md-8 col-xs-6">
                        <div class="bg-title hidden-sm hidden-xs">
                            <h4>Sự kiện đang diễn ra</h4>
                        </div>
                        @Html.Action("_EventItem", new { eventt = Model[0] })
                    </div>
                    @foreach (Event item in Model.Skip(1))
                    {
                        index++;

                        <div class="col-md-4 col-xs-6">
                            @Html.Action("_EventItem", new { eventt = item })
                        </div>

                        if (index % 3 == 0)
                        {
                            <div class="clearfix visible-lg visible-md"></div>
                        }
                        if (index % 2 == 0)
                        {
                            <div class="clearfix visible-sm visible-xs"></div>
                        }

                    }
                </div>
            </div>
        }
        else
        {
            <div class="bg-content">
                <img src="/img/no-event.png" class="center-block img-responsive" />
            </div>
        }

        @if (upcomingDate.Count > 0)
        {
            <div class="upComing">
                <div class="bg-title">
                    <h4>Sự kiện sắp diễn ra</h4>
                </div>
                <ul class="list-inline list-date">
                    @foreach (DateTime item in upcomingDate)
                    {
                        <li>
                            <a class="no-href" onclick="new Eventt().Upcoming(this, '@item', @category.Id)">
                                @String.Format("{0} tháng {1}", item.Day, item.Month)
                            </a>
                        </li>
                    }
                </ul>
                <div id="frmUpcomingEvent" class="row min-padding">
                    @Html.Action("_AjaxUpcomingEvent", new { date = upcomingDate.First(), categoryId = category.Id })
                </div>
            </div>
        }
    </div>
</div>

@section scripts {
    <script>
        $('#menuOne-@category.NameId').addClass('active');
        $('#menuTwo-@category.NameId').addClass('active');
        $('#menuTwoXs-@category.NameId').addClass('active');
        $('.list-date li:first-child').addClass('active');
    </script>
}